﻿@{
    ViewBag.Title = "Excluded Keywords";
}

@section scripts {
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Custom/ArticleJS.js")" type="text/javascript"></script>
}

<hgroup class="title">
    <h1>@ViewBag.Title</h1>
    <h2>@ViewBag.Message</h2>
</hgroup>

@using (Ajax.BeginForm("AddWord", "Home", 
    new AjaxOptions {
     InsertionMode=InsertionMode.Replace,
     HttpMethod="GET",
     OnFailure="displayFailed",     
     LoadingElementId="ajax-loader",
     UpdateTargetId="keywords",
     OnSuccess = "clearAddWords",              
}))
{
    <span style="font-weight:bold">Word: </span>
    <input type="text" name="e" style="width:100px" id="addInput" required="required" />
    <input type="submit" value="add" />
    <img id="ajax-loader1" 
         src="@Url.Content("~/Images/ajax-loader.gif")" 
         style="display:none"/>
}

@using (Ajax.BeginForm("UpdateWord", "Home", 
    new AjaxOptions {
     InsertionMode=InsertionMode.Replace,
     HttpMethod="POST",
     OnFailure="displayFailed",     
     LoadingElementId="ajax-loader",
     UpdateTargetId="keywords",
     OnSuccess = "clearAddWords",               
}))
{
    <span style="font-weight:bold">ID: </span><input type="text" name="id" style="width:50px" id="updateIDInput" required="required" />
    <span style="font-weight:bold">  Word: </span><input type="text" name="word" style="width:100px" id="updateWordInput"  required="required" />
    <input type="submit" value="update" />
    <img id="ajax-loader2" 
         src="@Url.Content("~/Images/ajax-loader.gif")" 
         style="display:none"/>
}

@using (Ajax.BeginForm("DeleteWord", "Home", 
    new AjaxOptions {
     InsertionMode=InsertionMode.Replace,
     HttpMethod="GET",
     OnFailure="displayFailed",     
     LoadingElementId="ajax-loader",
     UpdateTargetId="keywords",
     OnSuccess = "clearAddWords",               
}))
{
    <span style="font-weight:bold">ID: </span><input type="text" name="g" style="width:50px" id="deleteInput" required="required" />
    <input type="submit" value="delete" />
    <img id="ajax-loader3" 
         src="@Url.Content("~/Images/ajax-loader.gif")" 
         style="display:none"/>
}

<div id="message">
    @ViewBag.ResultMsg
</div>

<div id="keywords">
    <table>
        <tr>
            <th>Id</th>
            <th>Word</th>
        </tr>
        @foreach (var word in Model)
        {
            <tr>
                <td>@word.ExclusionId</td>
                <td>@word.Word</td>
            </tr>
        }
    </table>
</div>